import { request } from '@/utils/request'
import { url } from './url'

// 获取文档列表
export const getDocuments = (params) => request('get', `${url}/documents`, null, params)

// 上传文档
export const uploadDocuments = (data) => request('post', `${url}/documents/upload`, data, null)

// 更新文档信息
export const updateDocument = (id, data) => request('put', `${url}/documents/${id}`, data)

// 批量更新文档权限
export function batchUpdateVisibility(data) {
  return request({
    url: '/api/documents/batch-visibility',
    method: 'post',
    data
  })
}

// 删除文档
export const deleteDocument = (id) => request('delete', `${url}/documents/${id}`)

// 批量删除文档
export const batchDeleteDocuments = (ids) => request('delete', `${url}/documents/batch`, ids, null)

// 获取所有标签
export function getAllTags() {
  return request({
    url: '/api/admin/tags',
    method: 'get'
  })
}